package com.asuka.eva.controller.test;

import com.asuka.eva.comm.untils.RedisUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * @author ZuoWei Jin, 13504284153
 * @version 1.0
 * @description 1
 * @since 2021/10/8 23:16
 */
@Slf4j
@RequestMapping("/redis")
@RestController
public class RedisController {
    private static final int ExpireTime = 60;   // redis中存储的过期时间60s

    @Resource
    private RedisUtil redisUtil;

    @RequestMapping("get")
    public Object redisget(String key) {
        return redisUtil.get(key);
    }

    @RequestMapping("expire")
    public boolean expire(String key) {
        return redisUtil.expire(key, ExpireTime);
    }
}